home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / inter / connect.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-03-08  |  4.3 KB  |  149 lines

  1. VERSION 2.00
  2. Begin Form frmConnect 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Connect To Chat Line"
  5.    ClientHeight    =   2445
  6.    ClientLeft      =   2040
  7.    ClientTop       =   2535
  8.    ClientWidth     =   5010
  9.    ControlBox      =   0   'False
  10.    Height          =   2850
  11.    Icon            =   CONNECT.FRX:0000
  12.    Left            =   1980
  13.    LinkTopic       =   "Form3"
  14.    ScaleHeight     =   2445
  15.    ScaleWidth      =   5010
  16.    Top             =   2190
  17.    Width           =   5130
  18.    Begin CommandButton btnCancel 
  19.       Cancel          =   -1  'True
  20.       Caption         =   "C&ancel"
  21.       Height          =   420
  22.       Left            =   3825
  23.       TabIndex        =   3
  24.       Top             =   765
  25.       Width           =   1005
  26.    End
  27.    Begin CommandButton btnConnect 
  28.       Caption         =   "&Connect"
  29.       Default         =   -1  'True
  30.       Height          =   420
  31.       Left            =   3825
  32.       TabIndex        =   2
  33.       Top             =   225
  34.       Width           =   1005
  35.    End
  36.    Begin TextBox txtAlias 
  37.       FontBold        =   0   'False
  38.       FontItalic      =   0   'False
  39.       FontName        =   "MS Sans Serif"
  40.       FontSize        =   8.25
  41.       FontStrikethru  =   0   'False
  42.       FontUnderline   =   0   'False
  43.       Height          =   330
  44.       Left            =   450
  45.       TabIndex        =   1
  46.       Top             =   1890
  47.       Width           =   2940
  48.    End
  49.    Begin TextBox txtHost 
  50.       FontBold        =   0   'False
  51.       FontItalic      =   0   'False
  52.       FontName        =   "MS Sans Serif"
  53.       FontSize        =   8.25
  54.       FontStrikethru  =   0   'False
  55.       FontUnderline   =   0   'False
  56.       Height          =   330
  57.       Left            =   450
  58.       TabIndex        =   0
  59.       Top             =   1170
  60.       Width           =   2940
  61.    End
  62.    Begin TextBox txtPort 
  63.       FontBold        =   0   'False
  64.       FontItalic      =   0   'False
  65.       FontName        =   "MS Sans Serif"
  66.       FontSize        =   8.25
  67.       FontStrikethru  =   0   'False
  68.       FontUnderline   =   0   'False
  69.       Height          =   330
  70.       Left            =   450
  71.       TabIndex        =   4
  72.       Top             =   450
  73.       Width           =   1185
  74.    End
  75.    Begin Label Label1 
  76.       AutoSize        =   -1  'True
  77.       Caption         =   "Your Alias:"
  78.       Height          =   195
  79.       Index           =   2
  80.       Left            =   225
  81.       TabIndex        =   7
  82.       Top             =   1665
  83.       Width           =   930
  84.    End
  85.    Begin Label Label1 
  86.       AutoSize        =   -1  'True
  87.       Caption         =   "Remote Name:"
  88.       Height          =   195
  89.       Index           =   1
  90.       Left            =   225
  91.       TabIndex        =   6
  92.       Top             =   900
  93.       Width           =   1260
  94.    End
  95.    Begin Label Label1 
  96.       AutoSize        =   -1  'True
  97.       Caption         =   "Remote Port:"
  98.       Height          =   195
  99.       Index           =   0
  100.       Left            =   225
  101.       TabIndex        =   5
  102.       Top             =   180
  103.       Width           =   1125
  104.    End
  105. DefInt A-Z
  106. Sub btnCancel_Click ()
  107.     Hide
  108. End Sub
  109. Sub btnConnect_Click ()
  110. '-- Try to connect.
  111.     '-- You must supply a port, Host address
  112.     '   and your alias.
  113.     If Len(txtPort) Then
  114.         If Len(txtHost) Then
  115.             If Len(txtAlias) Then
  116.                 OK = True
  117.             End If
  118.         End If
  119.     End If
  120.     If Not OK Then
  121.         MsgBox "All fields are required!"
  122.         Exit Sub
  123.     End If
  124.     '-- Set the port and host name
  125.     frmLocal.dssLocal.RemotePort = Val(txtPort)
  126.     frmLocal.dssLocal.RemoteHost = txtHost
  127.     '-- Temporarily disable the form
  128.     Me.Enabled = False
  129.     Screen.MousePointer = 11
  130.     '-- Connect
  131.     On Local Error Resume Next
  132.     frmLocal.dssLocal.Action = DSSOCK_CONNECT
  133.     '-- Enable the form
  134.     Me.Enabled = True
  135.     Screen.MousePointer = 0
  136.     If Err Then
  137.         MsgBox "Connection Failed"
  138.     End If
  139.     Hide
  140. End Sub
  141. Sub Form_Load ()
  142.     '-- Initialize the Port dialog box with
  143.     '   the same port we're listening on.
  144.     txtPort = Trim$(Str$(ListenPort))
  145.     '-- Initialize the Alias to be the name
  146.     '   of the local machine
  147.     txtAlias = frmLocal.dssLocal.LocalName
  148. End Sub
  149.